import java.util.ArrayList;
import java.util.List;

public class Node implements Comparable<Node>{
	
	private Node parent;
	private String content;
	private int cost;
	private boolean visited;
	private List<Node> children = new ArrayList<Node>();
		
	public Node(){
		this(0, "", false, null);
	}
	
	public Node(String content){
		this(0, content, false, null);
	}
	
	public Node(int cost, String content, boolean visited, Node parent) {
		this.cost = cost;
		this.content = content;
		this.visited = visited;
		this.parent = parent;
	}
	
	public Node(Node node){
		this.parent = node.parent;
		this.content = node.content;
		this.cost = node.cost;
		this.visited = node.visited;
		this.children = node.children;
	}
		
	public Node addChild(int cost, String content){
		Node node  = new Node(cost, content, false, this);

		return this.children.add(node) ? node : null;
	}
	
	public boolean isVisited() {
		return visited;
	}

	public void setVisited(boolean visited) {
		this.visited = visited;
	}

	public Node getParent(){
		return this.parent;
	}

	public int getCost() {
		return cost;
	}

	public void setCost(int cost) {
		this.cost = cost;
	}

	public List<Node> getChildren() {
		return children;
	}

	public void setChildren(List<Node> children) {
		this.children = children;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public void setParent(Node parent) {
		this.parent = parent;
	}
	
	public int compareTo(Node a){
		
		return this.getCost() - a.getCost();
		
	}
	
	public boolean isEqual(Node node){
		if(this.getContent() == node.getContent()){
			return true;
		}
		return false;
	}
}
